DEFINE(IA64_KR_IO_BASE_OFFSET, offsetof (cpu_kr_ia64_t, _kr[IA64_KR_IO_BASE]));
DEFINE(IA64_KR_CURRENT_STACK_OFFSET, offsetof (cpu_kr_ia64_t, _kr[IA64_KR_CURRENT_STACK]));
+#ifdef PERF_COUNTERS
+ BLANK();
+ DEFINE(RECOVER_TO_PAGE_FAULT_PERFC_OFS, offsetof (struct perfcounter, recover_to_page_fault));
+ DEFINE(RECOVER_TO_BREAK_FAULT_PERFC_OFS, offsetof (struct perfcounter, recover_to_break_fault));
+#endif
}
uint64_t pta;
local_irq_save(spsr);
- context_switch_count++;
+ perfc_incrc(context_switch);
__ia64_save_fpu(prev->arch._thread.fph);
__ia64_load_fpu(next->arch._thread.fph);
PSCB(v,ifs) = regs->cr_ifs;
PSCB(v,incomplete_regframe) = 1;
regs->cr_ifs = 0;
- lazy_cover_count++;
+ perfc_incrc(lazy_cover);
return(1); // retry same instruction with cr.ifs off
}
return(0);
if (regs->r28 == PAL_HALT_LIGHT) {
if (vcpu_deliverable_interrupts(v) ||
event_pending(v)) {
- idle_when_pending++;
+ perfc_incrc(idle_when_pending);
vcpu_pend_unspecified_interrupt(v);
//printf("idle w/int#%d pending!\n",pi);
//this shouldn't happen, but it apparently does quite a bit! so don't
//as deliver_pending_interrupt is called on the way out and will deliver it
}
else {
- pal_halt_light_count++;
+ perfc_incrc(pal_halt_light);
do_sched_op_compat(SCHEDOP_yield, 0);
}
regs->r8 = 0;
// we get here if fast_insert fails (e.g. due to metaphysical lookup)
ENTRY(recover_and_page_fault)
-#ifdef FAST_REFLECT_CNT
- movl r21=recover_to_page_fault_count;;
+#ifdef PERF_COUNTERS
+ movl r21=perfcounters + RECOVER_TO_PAGE_FAULT_PERFC_OFS;;
ld8 r22=[r21];;
adds r22=1,r22;;
st8 [r21]=r22;;
// recovery block for hyper_itc metaphysical memory lookup
ENTRY(recover_and_dispatch_break_fault)
-#ifdef FAST_REFLECT_CNT
- movl r21=recover_to_break_fault_count;;
+#ifdef PERF_COUNTERS
+ movl r21=perfcounters + RECOVER_TO_BREAK_FAULT_PERFC_OFS;;
ld8 r22=[r21];;
adds r22=1,r22;;
st8 [r21]=r22;;
#include <xen/lib.h>
#include <asm/uaccess.h>
-unsigned long dtlb_translate_count = 0;
-unsigned long tr_translate_count = 0;
-unsigned long phys_translate_count = 0;
-unsigned long vhpt_translate_count = 0;
-unsigned long fast_vhpt_translate_count = 0;
-unsigned long recover_to_page_fault_count = 0;
-unsigned long recover_to_break_fault_count = 0;
-unsigned long idle_when_pending = 0;
-unsigned long pal_halt_light_count = 0;
-unsigned long context_switch_count = 0;
-unsigned long lazy_cover_count = 0;
-
unsigned long slow_hyperpriv_cnt[HYPERPRIVOP_MAX+1] = { 0 };
unsigned long fast_hyperpriv_cnt[HYPERPRIVOP_MAX+1] = { 0 };
return s - buf;
}
-static int dump_misc_stats(char *buf)
-{
- char *s = buf;
- s += sprintf(s,"Virtual TR translations: %ld\n",tr_translate_count);
- s += sprintf(s,"Virtual VHPT slow translations: %ld\n",vhpt_translate_count);
- s += sprintf(s,"Virtual VHPT fast translations: %ld\n",fast_vhpt_translate_count);
- s += sprintf(s,"Virtual DTLB translations: %ld\n",dtlb_translate_count);
- s += sprintf(s,"Physical translations: %ld\n",phys_translate_count);
- s += sprintf(s,"Recoveries to page fault: %ld\n",recover_to_page_fault_count);
- s += sprintf(s,"Recoveries to break fault: %ld\n",recover_to_break_fault_count);
- s += sprintf(s,"Idle when pending: %ld\n",idle_when_pending);
- s += sprintf(s,"PAL_HALT_LIGHT (no pending): %ld\n",pal_halt_light_count);
- s += sprintf(s,"context switches: %ld\n",context_switch_count);
- s += sprintf(s,"Lazy covers: %ld\n",lazy_cover_count);
- return s - buf;
-}
-
-static void zero_misc_stats(void)
-{
- dtlb_translate_count = 0;
- tr_translate_count = 0;
- phys_translate_count = 0;
- vhpt_translate_count = 0;
- fast_vhpt_translate_count = 0;
- recover_to_page_fault_count = 0;
- recover_to_break_fault_count = 0;
- lazy_cover_count = 0;
- pal_halt_light_count = 0;
- idle_when_pending = 0;
- context_switch_count = 0;
-}
-
static const char * const hyperpriv_str[HYPERPRIVOP_MAX+1] = {
0, "rfi", "rsm.dt", "ssm.dt", "cover", "itc.d", "itc.i", "ssm.i",
"=ivr", "=tpr", "tpr=", "eoi", "itm=", "thash", "ptc.ga", "itr.d",
n += dump_privop_addrs(buf + n);
#endif
n += dump_vhpt_stats(buf + n);
- n += dump_misc_stats(buf + n);
if (__copy_to_user(ubuf,buf,n))
return -1;
return n;
zero_privop_addrs();
#endif
zero_vhpt_stats();
- zero_misc_stats();
zero_reflect_counts();
if (__copy_to_user(ubuf,buf,n))
return -1;
*pteval = (address & _PAGE_PPN_MASK) | __DIRTY_BITS |
_PAGE_PL_2 | _PAGE_AR_RWX;
*itir = PAGE_SHIFT << 2;
- phys_translate_count++;
+ perfc_incrc(phys_translate);
return IA64_NO_FAULT;
}
}
if (trp != NULL) {
*pteval = trp->pte.val;
*itir = trp->itir;
- tr_translate_count++;
+ perfc_incrc(tr_translate);
return IA64_NO_FAULT;
}
}
if (trp != NULL) {
*pteval = trp->pte.val;
*itir = trp->itir;
- tr_translate_count++;
+ perfc_incrc(tr_translate);
return IA64_NO_FAULT;
}
}
&& vcpu_match_tr_entry_no_p(trp,address,rid)) {
*pteval = pte.val;
*itir = trp->itir;
- dtlb_translate_count++;
+ perfc_incrc(dtlb_translate);
return IA64_USE_TLB;
}
/* found mapping in guest VHPT! */
*itir = rr & RR_PS_MASK;
*pteval = pte.val;
- vhpt_translate_count++;
+ perfc_incrc(vhpt_translate);
return IA64_NO_FAULT;
}
-/* This file is empty. */
+#ifndef XEN_PERFC_DEFN_H
+#define XEN_PERFC_DEFN_H
+
+PERFCOUNTER_CPU(dtlb_translate, "dtlb hit")
+
+PERFCOUNTER_CPU(tr_translate, "TR hit")
+
+PERFCOUNTER_CPU(vhpt_translate, "virtual vhpt translation")
+PERFCOUNTER_CPU(fast_vhpt_translate, "virtual vhpt fast translation")
+
+PERFCOUNTER(recover_to_page_fault, "recoveries to page fault")
+PERFCOUNTER(recover_to_break_fault, "recoveries to break fault")
+
+PERFCOUNTER_CPU(phys_translate, "metaphysical translation")
+
+PERFCOUNTER_CPU(idle_when_pending, "vcpu idle at event")
+
+PERFCOUNTER_CPU(pal_halt_light, "calls to pal_halt_light")
+
+PERFCOUNTER_CPU(context_switch, "context switch")
+
+PERFCOUNTER_CPU(lazy_cover, "lazy cover")
+
+#endif
#define PRIVOP_ADDR_COUNT
-/* vcpu_translate hit with dtlb. */
-extern unsigned long dtlb_translate_count;
-
-/* vcpu_translate hit with tr. */
-extern unsigned long tr_translate_count;
-
-/* vcpu_translate in metaphysical mode. */
-extern unsigned long phys_translate_count;
-
-extern unsigned long vhpt_translate_count;
-extern unsigned long fast_vhpt_translate_count;
-extern unsigned long recover_to_page_fault_count;
-extern unsigned long recover_to_break_fault_count;
-extern unsigned long idle_when_pending;
-extern unsigned long pal_halt_light_count;
-extern unsigned long context_switch_count;
-extern unsigned long lazy_cover_count;
-
extern unsigned long slow_hyperpriv_cnt[HYPERPRIVOP_MAX+1];
extern unsigned long fast_hyperpriv_cnt[HYPERPRIVOP_MAX+1];